
import UtilFuncs from '../common/tools/utilfuncs.js'
var utilfuncs = UtilFuncs.UtilFuncs;

var SaveGraphFileSvc = {}

SaveGraphFileSvc.save = function (datamanger) {
    var graphFileObj = {};
    var array = [];
    var graphList = datamanger.getAllGraphs();
    var topoList = datamanger.getTopoList();
    for (var idx in graphList) {
        let obj = graphList[idx];
        var info = obj.toInfo();
        var jsonoj = info.toJson();
        array.push(jsonoj);
        console.log(obj);
    }
    graphFileObj["elements"] = array;
    var version = "v0.0.0.1";
    graphFileObj["version"] = version;
    graphFileObj["mapScale"] = datamanger.getMapScale();
    graphFileObj["fileKind"] = 0;
    return graphFileObj;
}

export default { SaveGraphFileSvc }